package com.hgy.carsb.entity;

import lombok.Data;

import java.math.BigDecimal;

@Data
public class IndicatorDetail {
    private String thisMonth;
    private String lastMonth;
    private String subMonth;
    private String thisYear;
    private String lastYear;
    private String subYear;

    public IndicatorDetail(){}

    public IndicatorDetail(String thisMonth, String lastMonth, String thisYear, String lastYear){
        set(thisMonth, lastMonth, thisYear, lastYear);
    }

    private void set(String thisMonth, String lastMonth, String thisYear, String lastYear){
        this.thisMonth = thisMonth;
        this.lastMonth = lastMonth;
        this.thisYear = thisYear;
        this.lastYear = lastYear;
        this.subMonth = new BigDecimal(thisMonth).subtract(new BigDecimal(lastMonth)).toString();
        this.subYear = new BigDecimal(thisYear).subtract(new BigDecimal(lastYear)).toString();
    }
}
